
/**
 * 链接数据库，并导出 数据库对象
 * 
 */

const mysql = require('mysql');

export let connect = function () {
    return mysql.createConnection({
        host: "192.168.27.254",
        port:3306,
        user: 'root',
        password: '123456',
        database: 'bybserver'
    })
}
export let connection = connect()

connection.connect(function (err) {

    if (err) {
        console.log("\n\n链接数据库报错--->\n\n");
        connection.isConnected = false
        return;
    }
    
    connection.isConnected=true
    console.log('\n\nconnected as id ' , connection.threadId,"\n\n");

});




